<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:89:"F:\phpstudy_pro\WWW\www.jiefanggongyuan.com\public/../wcapps/admin\view\liuyan\index.html";i:1637131750;}*/ ?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>留言管理</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link href="/static/skin/nei.css" type="text/css" rel="stylesheet">   
        <link rel="stylesheet" href="/static/skin/combo.select.css"> 
</head>


<body onLoad="initPage(),shenqing()">


<div id="LoadingBar"><img src="/static/images/load.gif" /></div>


<div class="contaiter">	


	<div class="shuaxin" onclick="location.reload()" title="刷新">&#xe614;</div>


	<div class="nei03">


    	<form action="/admin/liuyan/index" method="post">           


            <div class="nei03_01">   


                <div class="nei03_01_01">


                    模糊搜索：


                </div>


                <div class="nei03_01_03">


                    <input placeholder="请输入您的关键字" name="title" id="title" value="<?php echo $title; ?>" class="layui-input-2">


                </div>


                <div class="nei03_01_03">


                    <button type="submit" class="layui-input-3 layui-btn-green"><i class="layui-icon" style="font-size:18px;color:#FFF;">&#xe615;</i></button>


                </div>


                </div>               


        </form>


        <div class="nei03_02 site-demo-button" style="margin-top: 20px;">


            <span class="layui-btn  layui-btn-1" onClick="openAtrr('已处理','ifopen',1)">已处理</span>


            <span class="layui-btn  layui-btn-1" onClick="openAtrr('未处理','ifopen',0)">未处理</span>


            <button class="layui-btn-2" onClick="openPiDelete()" ><i>&#xe6f4;</i><em>批量删除</em></button> 


        </div>


    </div>





    <div class="nei02">


        <div class="nei02_01 l01">


            <div class="nei02_01_07">


            	<h3>


                	<i><label><input type="checkbox"  id="checkall" name="checkall"><tt>✓</tt></label></i>
                	<span class="s02">留言类型</span>                    
                    <span class="s02">留言姓名</span>
                	<span class="s02">联系方式</span>
                	<span class="s02">是否处理</span>
                	<span class="s02">是否回复</span>
                    <span class="s02">留言时间</span>
                    <span class="s03"></span>
                </h3>


                <div class="nei02_01_07_01" id="list1">


                </div>


                <div class="nei02_01_04_02" id="pageDemo"></div>


            </div>


        </div>        


    </div>    


</div>   


<input type="hidden" id="pages1" name="pages1" value="1">


<input type="hidden" id="xuesheng" name="xuesheng" value="">


<input type="hidden" id="jiaoxue" name="jiaoxue" value="">


<script src="/static/js/jquery-1.10.2.min.js" type="application/javascript"></script>


<script src="/static/js/neijqtab.js" type="application/javascript"></script>


<script src="/static/js/xlayui/layui.js" charset="utf-8"></script>


<script src="/static/js/jquery.combo.select.js"></script>


<script>


$(function() {


	$('select').comboSelect();


});


</script>


<script>


function initPage(){   


	var objLoading = document.getElementById("LoadingBar");   


	if (objLoading != null){   


		objLoading.style.display = "none";   


		$(".contaiter").css("display","block");


	}   


}  


</script>


<script>


layui.use(['form','laypage', 'layer'], function(){ //独立版的layer无需执行这一句


  var $ = layui.jquery,form = layui.form(),laypage = layui.laypage, layer = layui.layer; //独立版的layer无需执行这一句     


});





function openChuang(title,url){


	 var othis = $(this), method = othis.data('method');


    //多窗口模式，层叠置顶


      layer.open({


        type: 2 //此处以iframe举例


        ,title: title


         ,area: ['100%', '100%']


        ,shade: 0


        ,maxmin: true


        ,offset: [ //为了演示，随机坐标


          $(window).height()-$(window).height()


          ,$(window).width()-$(window).width()


        ] 


        ,content: url      


      });  


}





function pageNum(id,total,pages){


	layui.use('laypage', function(){ //独立版的layer无需执行这一句


	var laypage = layui.laypage; //独立版的layer无需执行这一句  


	laypage({


		cont: id //分页容器的id


		,pages: total //总页数


		,skin: '#5FB878' //自定义选中色值


		,curr: pages //当前页


		,skip: true //开启跳页


		,jump: function(obj, first){


		if(!first){			


			layer.msg('第'+ obj.curr +'页',{time:300});


			if(id=="pageDemo") shenqing(obj.curr);


		}


		}


		});	


	});		


}





function shenqing(pages){	


	title = $("#title").val();	


	$.ajax({


		type: "POST",


		async:false,


		contentType:"application/x-www-form-urlencoded; charset=UTF-8",


		url: "/admin/liuyan/lists",


		data: {pagesize:9,pages:pages,title:title},


		error:function(msg){ 


			alert("错误");


		},


		success:function(msg){


			 json = msg.data;	


			 var html="";


			 for(var i=0; i<json.length; i++)   


			 {  		   


			   ifopen = "未处理";
			   if(json[i].ifopen==1) ifopen = "<tt class='t01'>已处理</tt>";
			   status = "未回复";
			   if(json[i].back_content!="") status = "<tt class='t01'>已回复</tt>";


			   html += '<li><i><label><input type="checkbox" name="test" value="'+json[i].id+'"><tt>✓</tt></label></i><span class="s08">'+json[i].type+'</span><span class="s08">'+json[i].name+'</span><span class="s08">'+json[i].tel+'</span><span class="s08">'+ifopen+'</span><span class="s08">'+status+'</span><span class="s08">'+json[i].addtime+'</span><span class="s02 layui-btn layui-btn-nonebg"  onClick=openChuang("信息编辑","/admin/liuyan/edit/id/'+json[i].id+'")>&#xe617;</span><span class="s03 layui-btn layui-btn-nonebg-1" onclick=openDelete('+json[i].id+')>&#xe6f4;</span></li>';


			 }  


			$('#list1').html(html);


			pageNum('pageDemo',msg.totalpage,pages);		


			if(pages>1)


			 	$("#pages1").val(msg.totalpage);


			else


				$("#pages1").val(1);					 


		}


	});	


	


}


function openDelete(id){


	layer.confirm('确定要删除本条信息吗，删除无法恢复?', {icon: 3, title:'删除提示框'}, function(index){


		var loading2 = layer.load();			


		$.ajax({


			url:"/admin/liuyan/delete",


			type:"POST",


			data:{id:id},


			dataType:"",


			success:function(json){


				layer.close(loading2);


				if(json==1){			


					layer.alert("删除成功!");		


					shenqing($("#pages1").val());


				}else{


					layer.alert("删除失败",{time:1000});						


				}


				layer.close(index);


			},


			error:function(res){


				alert('删除语句错误!');


			}


		});		return false;


		


	});


}





function openPiDelete(){


	str = "删除";	


	var obj=document.getElementsByName('test');


		var s=''; 


		for(var i=0; i<obj.length; i++){ 


		if(obj[i].checked) s+=obj[i].value+','; //如果选中，将value添加到变量s中 


		} 


	id=s.substring(0,s.length-1);	


	if(id==''){


		layer.alert("请选择要"+str+"信息",{time:1000});


		return false;			


	}	


	layer.confirm('确定要'+str+'本条信息吗?', {icon: 3, title:''+str+'提示框'}, function(index){				


		$.ajax({


			url:"/admin/liuyan/delete",


			type:"POST",


			data:{id:id},


			dataType:"",


			success:function(json){


				if(json==1){			


					layer.alert(str+"成功!");		


					shenqing($("#pages1").val());


				}else{


					layer.alert(str+"失败",{time:1000});						


				}


				layer.close(index);


			},


			error:function(res){


				alert(res);


			}


		});		


		return false;


		


	});


}


function openAtrr(str,field,value){





	var obj=document.getElementsByName('test');


		var s=''; 


		for(var i=0; i<obj.length; i++){ 


		if(obj[i].checked) s+=obj[i].value+','; //如果选中，将value添加到变量s中 


		} 


	id=s.substring(0,s.length-1);


	if(id==''){


		layer.alert("请选择要"+str+"信息",{time:1000});


		return false;			


	}	


	layer.confirm('确定要'+str+'本条信息吗?', {icon: 3, title:''+str+'提示框'}, function(index){	


		var loading2 = layer.load();			


		$.ajax({


			url:"/admin/liuyan/Atrr",


			type:"POST",


			data:{id:id,field:field,value:value},


			dataType:"",


			success:function(json){


				layer.close(loading2);


				if(json==1){			


					layer.alert(str+"成功!",{time:1000});		


					shenqing($("#pages1").val());


				}else{


					layer.alert(str+"失败",{time:1000});						


				}


				layer.close(index);


			},


			error:function(res){


				alert(res);


			}


		});		


		return false;


		


	});


}


</script>


</body>


</html>


